new Vue({
	el: '#main',
	data: {
		image: "",
		data:"",
		currentWebview:"",
		ifLogin:localStorage.getItem("userData")
	},
	methods: {
		plusReady: function() {
			var context = this;
			if(this.ifLogin){
				ajAjax("app/user/getUserInfo.do", '', function(data) {
					console.log(JSON.stringify(data))
					context.data=data.user;
				}, function(err) {
	
				});
			}
			window.addEventListener("back",function(){
				context.currentWebview = plus.webview.currentWebview().data;
				context.ifLogin = context.currentWebview;
				if(context.currentWebview){
					ajAjax("app/user/getUserInfo.do", '', function(data) {
						console.log(JSON.stringify(data))
						context.data=data.user;
					}, function(err) {
		
					});
				}
			})
		
		},
		getMessage: function() {
			if(!this.ifLogin){
				commonOpenWindow("login.html","login.html",null,"1")
			}else{
				commonOpenWindow("mine/my-info.html","my-info.html",null,"1")
			}
		},
		scanCode: function() {
	 		commonOpenWindow("mine/scan.html","mine/scan.html",null,"1")
		},
		openMyActive:function(){
			 commonOpenWindow("active/my-active.html","active/my-active.html",null,"1")
		}
	},
	mounted: function() {
		if(window.plus) {
			this.plusReady();
		} else {
			document.addEventListener("plusready", this.plusReady, false);
		}
	}
});